﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class ChucNang_KhachHangThanThiet_KHTT_ThemSanPhamYeuThich : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        string sid=Request.QueryString.Get("Id");
        string page=Request.QueryString.Get("page");
        string url = Request.QueryString.Get("url");
        GlobalFunctions gf=new GlobalFunctions();
        if (sid != null && (gf.IsKHTT()== 1 || gf.IsKHDC() == 1 ))            
        {
             DataDSTableAdapters.SANPHAMYEUTHICHTableAdapter spytadapter = new DataDSTableAdapters.SANPHAMYEUTHICHTableAdapter();
             spytadapter.SANPHAMYEUTHICH_Them(gf.getCMND().Trim(), sid);
             if (page == null)
                 page = "0";
             if (url == null)
                 Response.Redirect("../NguoiDung/NguoiDung_XemDanhSachSanPham.aspx?page=" + page);
             else
                 //Response.Redirect(url);
                 Response.Write("<script>alert('Đã thêm sản phẩm vào danh sách ưa thích!');location.href='" + url + "'</script>");
            
        }
        else
            Response.Write("<script>alert('Vui lòng đăng nhập!');location.href='/SMO/ChucNang/NguoiDung/NguoiDung_DangNhap.aspx'</script>");
        
    }
}
